<!--
 * @Description: 
 * @Author: 张文韬
 * @Date: 2022-09-07 16:52:41
 * @LastEditTime: 2022-09-09 15:26:13
 * @LastEditors: 张文韬
 * @Reference: 
-->
<template>
  <editor-content :editor="editor" />
</template>

<script setup>
import { useEditor, EditorContent } from '@tiptap/vue-3'
import StarterKit from '@tiptap/starter-kit'


const props = defineProps({
  modelValue: {
    type: String,
    default: "",
  }
})

const emit = defineEmits(['update:modelValue'])

const editor = useEditor({
  content: props.modelValue,
  extensions: [StarterKit],
  onUpdate: ({editor}) => {
    let content = editor.getHTML()
    emit('update:modelValue', content)
  }
})

</script>